*===============================================================================
* Project title		Savings Accounts to Borrow Less	
* PIs			Felipe Kast, Dina Pomeranz 
* File name		5a_hetero_borrowing.do
*-------------------------------------------------------------------------------
* Description		Creates borrowing heterogeneity table 
* Outputs		Table A23 
* Spaces per tab 	8 
*===============================================================================

*===============================================================================
*TOC
*1)	Prepare data for analysis
*2)	Tables
*2.1)	Calculates table content 
*2.2)	Writes table
*===============================================================================

*===============================================================================
* Section 1 - Prepare data for analysis
*===============================================================================

clear all
global path "~/file_server/project_savings/2_shared/impact/do/November2019"	// Path to processed data
global results "$path/results"		
cd "$results"									// Change to directory to store results 
set more off
set trace off
*Loading processed data
	use $path/datasets/impactDatabase.dta, clear

*===============================================================================
* Section 2 - Tables 
*===============================================================================
* Section 2.1 - Calculates table content 
*-------------------------------------------------------------------------------

	eststo clear
	
// Calculates content for Panels C-F
	local i = 12
	
	foreach y in 									/// 
	w5_shortTermBorrowing /* A 13-18 */      w1_shortTermBorrowing /* A 19-24 */    ///    
	shortTermBorrowing /* A 25-30 */     IHSshortTermBorrowing /* A 31-36 */	///
	{
	
	local i = `i' + 1 //updates counter
	local j = 1 //tracks column number 
	
	reg d.`y' // mark subjects nonmissing in both periods
	egen t1 = max(e(sample)), by(idBaseSurvey)
		
		*Col 1 regression. 			
			reghdfe `y' c.accountAccess#c.post post if t1 == 1,	 ///
			abs(idBaseSurvey) vce(cluster groupId)
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
			
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post =      "No"
			estadd local hasacc_post =      "No"
                        estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
		
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number
			
		*Col 2 regression. 
			reghdfe `y' c.accountAccess#c.post#c.regretsNotSaving	///
			c.post#c.regretsNotSaving c.accountAccess#c.post post 	///
			if t1 == 1, abs(idBaseSurvey)		/// 
			vce(cluster groupId) 
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"Yes"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post = 	"No"
                        estadd local conflict_post = 	"No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
		
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number 

		*Col 3 regression. 
			reghdfe `y' c.accountAccess#c.post#c.hasPrevAccount	///
			c.post#c.hasPrevAccount c.accountAccess#c.post post 	///
			if t1 == 1, abs(idBaseSurvey) 		///
			vce(cluster groupId) 
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"Yes"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number
			
                *Col 4 regression. 
			reghdfe `y' c.accountAccess#c.post#c.sociallyTaxed	///
			c.post#c.sociallyTaxed c.accountAccess#c.post post 	///
			if t1 == 1, abs(idBaseSurvey) 		///
			vce(cluster groupId) 
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "Yes"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number

                 *Col 5 regression. 
			reghdfe `y' c.accountAccess#c.post#c.conflictsMoney	///
			c.post#c.conflictsMoney c.accountAccess#c.post post 	///
			if t1 == 1, abs(idBaseSurvey) 		///
			vce(cluster groupId) 
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "Yes"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number

                *Col 6 regression. 
			reghdfe `y' c.accountAccess#c.post#c.economicShock2009	///
			c.post#c.economicShock2009 c.accountAccess#c.post post 	///
			if t1 == 1, abs(idBaseSurvey) 		///
			vce(cluster groupId) 
			
			gen `y'_s`j' = e(sample) //marks observations used in sample for regression
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "Yes"
			eststo A`i'


		drop t1	
		di in red "`i'"
	}

// Variables to add as restrictions in regression for panels A and B 
	foreach x in 1 2 3 4 5 6 {
	gen in_s`x' = 1 if w5_shortTermBorrowing_s`x' == 1 & w1_shortTermBorrowing_s`x' == 1 	///
	& shortTermBorrowing_s`x' == 1 & IHSshortTermBorrowing_s`x' == 1
	}
	
	
// Calculates content for Panels A and B	
	local i = 0
	
	foreach y in prShortTermBorrowingTot /*A1-6*/ stBorrowTotalIndex /*A7-12*/ ///
	{
	
	local i = `i' + 1 //updates counter
	local j = 1 //tracks column number 
	
	reg d.`y' // mark subjects nonmissing in both periods
	egen t1 = max(e(sample)), by(idBaseSurvey)
		
		*Col 1 regression. 			
			reghdfe `y' c.accountAccess#c.post post if t1 == 1 & in_s`j' == 1,	 ///
			abs(idBaseSurvey) vce(cluster groupId)
			
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post =      "No"
			estadd local hasacc_post =      "No"
                        estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
		
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number
			
		*Col 2 regression. 
			reghdfe `y' c.accountAccess#c.post#c.regretsNotSaving	///
			c.post#c.regretsNotSaving c.accountAccess#c.post post 	///
			if t1 == 1 & in_s`j' == 1, abs(idBaseSurvey)	/// 
			vce(cluster groupId) 
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"Yes"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post = 	"No"
                        estadd local conflict_post = 	"No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
		
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number 

		*Col 3 regression. 
			reghdfe `y' c.accountAccess#c.post#c.hasPrevAccount	///
			c.post#c.hasPrevAccount c.accountAccess#c.post post 	///
			if t1 == 1 & in_s`j' == 1, abs(idBaseSurvey) 		///
			vce(cluster groupId) 
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"Yes"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number
			
                *Col 4 regression. 
			reghdfe `y' c.accountAccess#c.post#c.sociallyTaxed	///
			c.post#c.sociallyTaxed c.accountAccess#c.post post 	///
			if t1 == 1 & in_s`j' == 1, abs(idBaseSurvey) 	///
			vce(cluster groupId) 
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "Yes"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number

                 *Col 5 regression. 
			reghdfe `y' c.accountAccess#c.post#c.conflictsMoney	///
			c.post#c.conflictsMoney c.accountAccess#c.post post 	///
			if t1 == 1 & in_s`j' == 1, abs(idBaseSurvey) 	///
			vce(cluster groupId) 
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "Yes"
                        estadd local ecoshock_post =    "No"
			eststo A`i'
			
		local i = `i' + 1 //updates counter
		local j = `j' + 1 //updates col number

                *Col 6 regression. 
			reghdfe `y' c.accountAccess#c.post#c.economicShock2009	///
			c.post#c.economicShock2009 c.accountAccess#c.post post 	///
			if t1 == 1 & in_s`j' == 1, abs(idBaseSurvey) 	///
			vce(cluster groupId) 
					
			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"No"
			estadd local hasacc_post = 	"No"
			estadd local soctaxed_post =    "No"
                        estadd local conflict_post =    "No"
                        estadd local ecoshock_post =    "Yes"
			eststo A`i'


		drop t1	
		di in red "`i'"
	}
	
//Col 7 8 9 regressions below:
// Panels C-F

	local i = 8
	
	foreach y in w5_shortTermBorrowing	w5_stBorrowFamily       w5_stBorrowProviders   w5_stBorrowInstitutions 		/*B9-12*/	///
			w1_shortTermBorrowing	w1_stBorrowFamily       w1_stBorrowProviders   w1_stBorrowInstitutions		/*B13-16*/ 	///
			shortTermBorrowing	stBorrowFamily          stBorrowProviders      stBorrowInstitutions		/*B17-20*/ 	///
			IHSshortTermBorrowing	IHSstBorrowFamily       IHSstBorrowProviders   IHSstBorrowInstitutions 		/*B21-24*/  {
				
			local i = `i' + 1
			reg d.`y' //trick to mark subjects nonmissing in both periods
			egen t1 = max(e(sample)), by(idBaseSurvey)		
			
			reghdfe `y' c.accountAccess#c.post#c.hasPrevAccount 	///
			c.accountAccess#c.post#c.regretsNotSaving 		///
			c.accountAccess#c.post#c.sociallyTaxed 			///
			c.accountAccess#c.post#c.conflictsMoney 		///
			c.accountAccess#c.post#c.economicShock2009 		///
			c.post#c.hasPrevAccount c.post#c.regretsNotSaving 	///
			c.post#c.sociallyTaxed c.post#c.conflictsMoney 		///
			c.post#c.economicShock2009  				///
			c.accountAccess#c.post post if t1 == 1, abs(idBaseSurvey) ///
			vce(cluster groupId) 
			
			gen `y'_s = e(sample) //marks observations used in the regression 

			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"Yes"
			estadd local hasacc_post = 	"Yes"
			estadd local soctaxed_post =    "Yes"
                        estadd local conflict_post =    "Yes"
                        estadd local ecoshock_post =    "Yes"
			eststo B`i'
			
		drop t1
		di in red "`i'"

	}
	
// Variables to add as condition in regression for panels A and B 
	
	gen prShortTermBorrowingTot_s = w5_shortTermBorrowing_s
	gen stBorrowTotalIndex_s = w1_shortTermBorrowing_s
	gen prShortTermBorrowFamily_s = w5_stBorrowFamily_s
	gen stBorrowFamilyIndex_s = w1_stBorrowFamily_s
	gen prShortTermBorrowProv_s = w5_stBorrowProviders_s
	gen stBorrowProvidersIndex_s = w1_stBorrowProviders_s
	gen prShortTermBorrowInst_s = w5_stBorrowInstitutions_s
	gen stBorrowInstitutionsIndex_s = w1_stBorrowInstitutions_s
	
// Panel A & B 
	local i = 0
	
	foreach y in prShortTermBorrowingTot prShortTermBorrowFamily prShortTermBorrowProv  prShortTermBorrowInst 		/*B1-4*/	///
			stBorrowTotalIndex      stBorrowFamilyIndex     stBorrowProvidersIndex stBorrowInstitutionsIndex	/*B15-8*/ 	///  
			{
				
			local i = `i' + 1
			reg d.`y' //trick to mark subjects nonmissing in both periods
			egen t1 = max(e(sample)), by(idBaseSurvey)		
			
			reghdfe `y' c.accountAccess#c.post#c.hasPrevAccount 	///
			c.accountAccess#c.post#c.regretsNotSaving 		///
			c.accountAccess#c.post#c.sociallyTaxed 			///
			c.accountAccess#c.post#c.conflictsMoney 		///
			c.accountAccess#c.post#c.economicShock2009 		///
			c.post#c.hasPrevAccount c.post#c.regretsNotSaving 	///
			c.post#c.sociallyTaxed c.post#c.conflictsMoney 		///
			c.post#c.economicShock2009  				///
			c.accountAccess#c.post post if t1 == 1 & `y'_s == 1, 	///
			abs(idBaseSurvey) ///
			vce(cluster groupId) 
			
		 

			//adding control mean		
			sum `y' if accountAccess == 0 & post == 1
			if (abs(`r(mean)') < 100) {
				estadd local control_mean = trim("`: display %12.3fc r(mean)'")
			} 
			else {
				estadd local control_mean = trim("`: display %12.0fc r(mean)'")
			}
			
			distinct idBaseSurvey  if e(sample)
			estadd scalar num_ind = r(ndistinct)
			estadd local ind_fixeff = 	"Yes"
			estadd local regret_post = 	"Yes"
			estadd local hasacc_post = 	"Yes"
			estadd local soctaxed_post =    "Yes"
                        estadd local conflict_post =    "Yes"
                        estadd local ecoshock_post =    "Yes"
			eststo B`i'
			
		drop t1
		di in red "`i'"

	}
                
*-------------------------------------------------------------------------------
* Section 2.2 - Writes table 
*-------------------------------------------------------------------------------

//probability	
	esttab A1 A2 A3 A4 A5 A6 B1 B2 B3 B4 using tab_het_borrow.tex, replace		///
	cells(b(star fmt(%12.3fc)) se(par fmt(%12.3fc))) label style(tex) nonumber	///
	stats( control_mean, fmt(%12.3fc %12.0fc %12.0fc)				///
	label("Control mean")) mlabels(,none) 						///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	starlevels(* 0.1 ** 0.05 *** 0.01) 						///
	prehead(\begin{tabular}{l*{@M}{c}} \hline \hline) 				 ///	
	posthead(	& (1) 		& (2) 		& (3) 		& (4) 		& (5) 		& (6) 		& (7) 		& (8) 		& (9) 		& (10) \\ 		///
			& Total 	& Total 	& Total 	& Total 	& Total 	& Total 	& Total 	& Owed to    	& Owed to    	& Owed to \\ 		///
			& short-term	& short-term	& short-term	& short-term	& short-term	& short-term	& short-term	& family and 	& service   	& business \\		///
			& borrowing	& borrowing	& borrowing	& borrowing	& borrowing	& borrowing	& borrowing	& friends    	& providers 	& contacts and \\ 	///
			& 		&    	     	& 	        & 		&    	     	& 	        & 		&    	     	& 	        & institutions	\\  	///  
		\hline \\ \multicolumn{@span}{l}{\textbf{Panel A:} Probability of Any Borrowing} \\ ) 		///
	prefoot( ) 												/// 
	postfoot( )

//categories
	esttab A7 A8 A9 A10 A11 A12 B5 B6 B7 B8 using tab_het_borrow.tex, append	///
	cells(b(star fmt(%12.3fc)) se(par fmt(%12.3fc))) label style(tex) nonumber	///
	stats( control_mean, fmt(%12.3fc %12.0fc %12.0fc)				///
	label("Control mean")) mlabels(,none) 						///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	starlevels(* 0.1 ** 0.05 *** 0.01) 						///
	prehead( )									///
	posthead(\\ \multicolumn{@span}{l}{\textbf{Panel B:} Categories of Borrowing} \\) ///
	prefoot( ) postfoot( )
	
//winsor 5%
	esttab A13 A14 A15 A16 A17 A18 B9 B10 B11 B12 using tab_het_borrow.tex, append	///
	cells(b(star fmt(%12.0fc)) se(par fmt(%12.0fc))) label style(tex) nonumber	///
	stats( control_mean, fmt(%12.3fc %12.0fc %12.0fc)				///
	label("Control mean")) mlabels(,none) 						///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///	
	starlevels(* 0.1 ** 0.05 *** 0.01) 						///
	prehead( )									///
	posthead(\\ \multicolumn{@span}{l}{\textbf{Panel C:}  Amounts (Winsorized at the Top 5\%)} \\) ///
        prefoot( ) ///
	postfoot( )

//winsor 1%
	esttab A19 A20 A21 A22 A23 A24 B13 B14 B15 B16 using tab_het_borrow.tex, append	///
	cells(b(star fmt(%12.0fc)) se(par fmt(%12.0fc))) label style(tex) nonumber	        ///
	stats( control_mean, fmt(%12.3fc %12.0fc %12.0fc)			                ///
	label("Control mean")) mlabels(,none) 		                                ///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	starlevels(* 0.1 ** 0.05 *** 0.01) 						///
	prehead( ) 				 ///	
	posthead( \\ \multicolumn{@span}{l}{\textbf{Panel D:} Amounts (Winsorized at the Top 1\%)} \\) 		///
	prefoot( ) 					///													
	postfoot( \\ \hline \hline \end{tabular} )

	
// non-winsorized
	esttab A25 A26 A27 A28 A29 A30 B17 B18 B19 B20 using tab_het_borrow2.tex, replace	///
	cells(b(star fmt(%12.0fc)) se(par fmt(%12.0fc))) label style(tex) nonumber	///
	stats( control_mean, fmt(%12.3fc %12.0fc %12.0fc)				///
	label("Control mean")) mlabels(,none) 						///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	starlevels(* 0.1 ** 0.05 *** 0.01) 						///
	prehead( \begin{tabular}{l*{@M}{c}} \hline \hline )				///
	posthead(	& (1) 		& (2) 		& (3) 		& (4) 		& (5) 		& (6) 		& (7) 		& (8) 		& (9) 		& (10) \\ 		///
			& Total 	& Total 	& Total 	& Total 	& Total 	& Total 	& Total 	& Owed to    	& Owed to    	& Owed to \\ 		///
			& short-term	& short-term	& short-term	& short-term	& short-term	& short-term	& short-term	& family and 	& service   	& business \\		///
			& borrowing	& borrowing	& borrowing	& borrowing	& borrowing	& borrowing	& borrowing	& friends    	& providers 	& contacts and \\ 	///
			& 		&    	     	& 	        & 		&    	     	& 	        & 		&    	     	& 	        & institutions	\\  	///  
		\hline \\ \multicolumn{@span}{l}{\textbf{Panel E:} Non-Winsorized Amounts} \\) ///
	prefoot( ) postfoot( )	
	
// IHS
	esttab A31 A32 A33 A34 A35 A36 B21 B22 B23 B24 using tab_het_borrow2.tex, append ///
	cells(b(star fmt(%12.3fc)) se(par fmt(%12.3fc))) label style(tex) nonumber	///
	stats( control_mean num_ind N regret_post hasacc_post soctaxed_post conflict_post ///
	ecoshock_post ind_fixeff, fmt(%12.3fc %12.0fc %12.0fc)				///
	label("Control mean" "\\ \hline Individuals" "Observations" 			///
		"Post $\times$ regret not saving more" 					///
		"Post $\times$ already has bank account" 				///
		"Post $\times$ socially taxed"						///
		"Post $\times$ household conflicts"					///
		"Post $\times$ economic shock"						///
		"Individual FE" )) mlabels(,none) 					///	
	collabels(, none) eqlabels(, none)  						///
	keep(c.accountAccess#c.post#c.regretsNotSaving 					///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	order(c.accountAccess#c.post#c.regretsNotSaving 				///
		c.accountAccess#c.post#c.hasPrevAccount 				///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		c.accountAccess#c.post#c.conflictsMoney 				///
		c.accountAccess#c.post#c.economicShock2009 				///
		c.accountAccess#c.post)							///
	varlabels(c.accountAccess#c.post#c.regretsNotSaving 				///
		"Account $\times$ post $\times$ regret not saving more"         	///
		c.accountAccess#c.post#c.hasPrevAccount 				/// 
		"Account $\times$ post $\times$ already has bank account"	        ///
		c.accountAccess#c.post#c.sociallyTaxed 					///
		"Account $\times$ post $\times$ socially taxed"		                ///
		c.accountAccess#c.post#c.conflictsMoney 				///
		"Account $\times$ post $\times$ household conflicts"			///
		c.accountAccess#c.post#c.economicShock2009 				///
		"Account $\times$ post $\times$ economic shock"                 	///	
		c.accountAccess#c.post "Account $\times$ post")				///
	prehead( ) ///
	posthead(\\ \multicolumn{@span}{l}{\textbf{Panel F:} Inverse Hyperbolic Sine of Amount} \\ ) ///
	prefoot( ) ///
	postfoot(\hline \hline \end{tabular} )	
	
	
